package shsi2rpt

class ToDeShanBoxUpOddController {

    def commonDataService
    def dynamicQueryService
    def index(Integer max) {
        def cellList = org.kdx.DataUtils.getCellList()
        def pageSizeList = org.kdx.DataUtils.getPageSizeList()

        [totalCount: 5, pageSize: 20, pageCurrent: 1, orderField: 'id', orderDirection: 'asc', pageSizeList: pageSizeList, cellList: cellList]
    }

    def toDeShanBoxUpOdd(){
        def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
        def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 10
        params.startno = (pageSize * (pageCurrent - 1)) + 1
        params.endno = pageSize * pageCurrent
        def pageSizeList = [10,20,50,100]
        def toDeShanBoxUpOdd=[]
        def tableHeadList =  []
        def totalCount=0

        if(params.EXPORT_CONTENT_NAME=='Excel'){
            params.SYS_QUERY_NAME = 'toDeShanBoxUpOdd'
            toDeShanBoxUpOdd = dynamicQueryService.queryForList(params)

            if(toDeShanBoxUpOdd.size()>0){
                tableHeadList =  toDeShanBoxUpOdd[0].keySet()
            }
            params.SYS_QUERY_NAME = 'toDeShanBoxUpOddCount'
            totalCount = dynamicQueryService.queryForList(params)[0].TOTALCOUNT


        }


        [totalCount:totalCount,tableHeadList:tableHeadList, pageSizeList:pageSizeList,pageSize:pageSize, startno:params.startno?:'',endno:params.endno?:'',
         toDeShanBoxUpOdd:toDeShanBoxUpOdd,startTime:params.startTime?:''
        ]
    }
}
